package com.ruoyi.life.service.impl;

import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import cn.hutool.core.util.IdUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.common.core.utils.SecurityUtils;
import com.ruoyi.life.mapper.FeElevatorMapper;
import com.ruoyi.omp.api.domain.FeElevator;
import com.ruoyi.life.service.IFeElevatorService;

/**
 * 电梯费用Service业务层处理
 *
 * @author cjie
 * @date 2021-09-17
 */
@Service
public class FeElevatorServiceImpl implements IFeElevatorService {
    @Autowired
    private FeElevatorMapper feElevatorMapper;

    /**
     * 查询电梯费用
     *
     * @param id 电梯费用ID
     * @return 电梯费用
     */
    @Override
    public FeElevator selectFeElevatorById(String id) {
        return feElevatorMapper.selectFeElevatorById(id);
    }

    /**
     * 查询电梯费用列表
     *
     * @param feElevator 电梯费用
     * @return 电梯费用
     */
    @Override
    public List<FeElevator> selectFeElevatorList(FeElevator feElevator) {
        return feElevatorMapper.selectFeElevatorList(feElevator);
    }

    /**
     * 新增电梯费用
     *
     * @param feElevator 电梯费用
     * @return 结果
     */
    @Override
    public int insertFeElevator(FeElevator feElevator) {
        feElevator.setId(IdUtil.getSnowflake(0, 0).nextIdStr());
        feElevator.setCreateTime(DateUtils.getNowDate());
        feElevator.setCreateBy(SecurityUtils.getUsername());
        return feElevatorMapper.insertFeElevator(feElevator);
    }

    /**
     * 修改电梯费用
     *
     * @param feElevator 电梯费用
     * @return 结果
     */
    @Override
    public int updateFeElevator(FeElevator feElevator) {
        feElevator.setUpdateTime(DateUtils.getNowDate());
        feElevator.setUpdateBy(SecurityUtils.getUsername());
        return feElevatorMapper.updateFeElevator(feElevator);
    }

    /**
     * 批量删除电梯费用
     *
     * @param ids 需要删除的电梯费用ID
     * @return 结果
     */
    @Override
    public int deleteFeElevatorByIds(String[] ids) {
        return feElevatorMapper.deleteFeElevatorByIds(ids);
    }

    /**
     * 删除电梯费用信息
     *
     * @param id 电梯费用ID
     * @return 结果
     */
    @Override
    public int deleteFeElevatorById(String id) {
        return feElevatorMapper.deleteFeElevatorById(id);
    }
}
